<%@page import="model.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
	User u =new User();
//	kiem tra có phải admin không nếu khong thi redirect home
	if (!u.isAdmin((String) session.getAttribute("lv"))) {
		response.sendRedirect("../index.jsp");
	}
	Actor actor = new Actor();
	String acid = (String) request.getParameter("acid");
	/* nid nếu không tồn tại hoặc người dùng nhập vào không đúng thì báo lỗi và redirect về adminhome */
		if (!actor.isAcID(acid)) {
			response.sendRedirect("message.jsp?m=err-acid&r=vac");
		}else {
			acid.trim();
			actor =actor.getActor(Integer.parseInt(acid));
		}
	//su ly co loi xay ra
	String n = ((String)request.getAttribute("n"));
	String bio = ((String)request.getAttribute("bio"));
	String en = ((String)request.getAttribute("en"));
	
	n = (n==null)? actor.getAc_name():n ;
	bio =(bio==null)? actor.getAc_bio():bio;
	en = (en==null)? "*":en ;

%>
<title>MYFILM - Edit Categories</title>
		<form action="EditActor" onsubmit="return validate(this)" method="post">
			<fieldset>
				<legend>Edit Actor</legend>
				<div>
					<label for="n">Actor Name: <span class="required"><%=en %></span></label>
					<input type="text" name="n" value="<%=n%>" size="20" maxlength="150" tabindex="1"/>
				</div>
				<div>
					<label for="bio"  > Bio : </label> 
					<textarea name="bio" rows="3" cols="50" tabindex="2"><%=bio %></textarea>
				</div>
				<input type="hidden" name="acid" value="<%=acid%>">
			</fieldset>
			<p>
				<input type="submit" name="submit" value="Add Cat" />
			</p>
		</form>